﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test.Utils
{
    public class HyperFileUtil
    {

        //加载文件到矩阵
        public static string[][] ReadDataToArray(string path) {
            List<string[]> dataList = new List<string[]>();
            
            using(FileStream fs=new FileStream(path,FileMode.Open))
            using(StreamReader sr=new StreamReader(fs)){
                string line = "";
                while((line=sr.ReadLine())!=null){
                    string[] linesplit = line.Split(new char[]{'\t'});
                    dataList.Add(linesplit);
                }
            
            }
            int lineNum = dataList.Count();
            int coloumNum = dataList.ElementAt(0).Length;
            string[][] datas = new string[lineNum][];
            int i = 0;
            foreach (string[] item in dataList)
            {
                datas[i] = item;
                i++;
            }
            return datas;
        }

    }
}
